package org.aurora.model.request;

import org.aurora.model.entity.ScheduleTask;
import org.aurora.model.entity.ScheduleTaskContext;
import org.aurora.model.entity.Task;
import org.aurora.model.type.RequestCommandType;
import org.aurora.remote.protocol.RemoteRequest;

import java.io.Serializable;

public class ExecuteTaskRequest extends RemoteRequest implements Serializable {
    private String taskName;

    private ScheduleTaskContext context;

    public ExecuteTaskRequest() {
    }

    public ExecuteTaskRequest(Task task, ScheduleTask scheduleTask) {
        this.taskName = task.getName();
        this.context = new ScheduleTaskContext(task, scheduleTask);
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public ScheduleTaskContext getContext() {
        return context;
    }

    public void setContext(ScheduleTaskContext context) {
        this.context = context;
    }

    @Override
    public int getCommandCode() {
        return RequestCommandType.EXECUTE_TASK.getCode();
    }
}
